﻿using HBase;
using hconnect;
using hCommand;
using Persistence;
using System;
using System.Collections.Generic;
using Dapper;
using System.Data;
namespace Controller
{
    public class StatTask : ZtTask {
         
        IDoiServer doiServer = WMSDalFactray.getDal<IDoiServer>();

        IStatServer statServer = WMSDalFactray.getDal<IStatServer>();
 
        protected override bool init() {
            time = 3000;
            return true;
        }
        
        public bool auto = false;
        public bool manual = true;
        public override bool excute() {
             var param = new DynamicParameters();
            param.Add("@taskno", 20);
            param.Add("@msg",  "",DbType.String, direction: ParameterDirection.Output);
            doiServer.execProcedure("trans_delete",param);
            String v=param.Get<object>("@msg").ToString();
             
            if (auto || manual) {
                doiServer.statData();
                if (auto) {
                    oneTimeSleep = 3600;
                }
                auto = false;
                manual = false;  
            }
            if (DateTime.Now.Hour == 22) {
                if (!auto) {
                    auto = true ;
                }
            }

            statServer.statDoi();

            statServer.statDoo();
            statServer.statBatch();
            statServer.statItme();  

            return true;
        }

     
      
    }


}